package com.haixin.security.service.impl;


import com.haixin.security.bean.Role;
import com.haixin.security.dao.RoleMapper;
import com.haixin.security.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;

    @Override
    public List<Role> getAllRoles() {
        return roleMapper.getAllRoles();
    }

    @Override
    public Role getRoleById(int id) {
        return roleMapper.getRoleById(id);
    }

    @Override
    public boolean addRole(Role role) {
        return roleMapper.insertRole(role) > 0;
    }

    @Override
    public boolean updateRole(Role role) {
        return roleMapper.updateRole(role) > 0;
    }

    @Override
    public boolean deleteRole(int id) {
        return roleMapper.deleteRole(id) > 0;
    }
}
